package com.huawei.appgallery.forum.section.view.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;
import androidx.annotation.Nullable;
import com.huawei.appgallery.foundation.ui.css.CSSRule;
import com.huawei.appgallery.foundation.ui.css.CSSViewProxy;
import com.huawei.appgallery.foundation.ui.css.RenderListener;
import com.huawei.appgallery.foundation.ui.css.adapter.CSSPropertyName;
import com.huawei.appgallery.foundation.ui.css.adapter.type.CSSMonoColor;
import com.huawei.appgallery.foundation.ui.css.adapter.type.CSSValue;
import o.cab.d;
import o.epo;

public class NoticeTopImage extends ImageView implements RenderListener {
    public NoticeTopImage(Context context) {
        super(context);
    }

    public NoticeTopImage(Context context, @Nullable AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    public NoticeTopImage(Context context, @Nullable AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
    }

    public boolean onRenderReady(CSSViewProxy cSSViewProxy) {
        CSSRule rule = cSSViewProxy.getRule();
        if (rule.getStyleDeclaration() != null) {
            CSSValue propertyValue = rule.getStyleDeclaration().getPropertyValue(CSSPropertyName.BACKGROUND_COLOR);
            if (propertyValue instanceof CSSMonoColor) {
                setBackground(epo.ॱ(getResources().getDrawable(d.ͺ), ((CSSMonoColor) propertyValue).getColor()));
            }
        }
        return false;
    }
}
